/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Control;
import Model.*;
import DBLayer.*;
import java.util.ArrayList;
/**
 *
 * @author Radu
 */
public class CtrEmployee {
    public CtrEmployee() {

    }
    public ArrayList findAllEmployee()
    {
      DbInterfaceEmployee dbEmp = new DbEmployee();
      ArrayList allEmp = new ArrayList();
      allEmp = dbEmp.getAllEmployees("");
      return allEmp;
    }
    public Employee findByName(String name)
    {
        DbInterfaceEmployee dbEmp = new DbEmployee();
        return dbEmp.searchByName(name);
    }

      public Employee findById(String id)
    {
        DbInterfaceEmployee dbEmp = new DbEmployee();
        return dbEmp.searchById(id);
    }
      public int updateEmp(String name, String address, String zip, String city, String phone, String email)
      {
          DbInterfaceEmployee dbEmp = new DbEmployee();
          Employee emp = new Employee();
          emp.setName(name);
          emp.setAddress(address);
          emp.setZip(zip);
          emp.setCity(city);
          emp.setPhone(phone);
          emp.setEmail(email);
          return  dbEmp.updateEmployee(emp);


      }

      public void insertNew(Employee empObj)
      {
           DbInterfaceEmployee dbEmp = new DbEmployee();
           dbEmp.insertEmployee(empObj);
      }

      public void deleteEmployee(String phone){
          DbInterfaceEmployee dbEmp = new DbEmployee();
          dbEmp.deleteEmployee(phone);
      }

}
